I want to make an chrome extension that detects what site you are on, and it blocks you from entering unless its a site that's allowed by the program, and if it isn't allowed it redirects you to an allowed site
im trying to use this code, to redirect to another webiste:
if (document.URL.includes("https://www.facebook.com") ) {
//something
} else {
window.location.replace("http://stackoverflow.com");
}
and it doesn't work, even though this code works:
if (document.URL.includes("https://www.facebook.com")) {
window.location.replace("http://stackoverflow.com");
}
i assume it works because i have this in my manifest.json:
"matches": ["https://www.facebook.com/*"]
So how can you use matches with every website?
thanks for the help!